<?php
	if(!isset($_REQUEST['ajax'])){ $_REQUEST['ajax'] = "";}
	if($_REQUEST['ajax']!=true) include 'header.tpl.php';
	include 'usercp_panel.tpl.php';
?>
	<div class="row">
		<div class="col-lg-12">
			<div class="panel">
				<div class="panel-heading">
					<div class="panel-title"><?php echo $this->language['mail_inbox'];?></div>
				</div>
				<div class="panel-body">
					<form action="javascript:doSearchMsg();" class="form-inline">
						<label>Tìm kiếm : </label>
						<input type="text" class="form-control" placeholder="Tiêu đề,Nội dung" id="search_content" name="content"> 
						<select name="nguoigui" id="search_nguoigui" class="form-control"><?php echo "<option value='0'>Tất cả Người Gửi</option>"; foreach($this->nguoigui as $item){echo "<option value='".$item['msgSender']."'>".$_SESSION['user_data'][$item['msgSender']]['fullname']."</option>";}?></select> 
						<input type="submit" value="Tìm" class="btn btn-warning" >
					</form>
					<div class="clear"></div>
					<table class="table table-fixed table-hover table-condensed">
						<thead>
							<tr>
								<th width="25px"><input type="checkbox" id="checkAll" onClick="checkAllMsg();" / ></th>
								<th>Tiêu đề</th>
								<th>Nội dung</th>
								<th width="130px">Thời gian</th>
								<th width="110px">Người gửi</th>
							</tr>
						</thead>
						<tbody>
							<?php
							$STT = 0;
							foreach($this->msg as $msg){
								$STT++; ?>
								<?php if($msg['msgStatus']==0){$style="style='font-weight:bold;'"; echo "<tr style=\"border-bottom:1px solid #d5d4d4;\">";}
									else{$style=""; echo "<tr style=\"background:#f3f3f3;border-bottom:1px solid #d5d4d4;\">";}?>
									<td><input type="checkbox" id="msg<?php echo $STT;?>" value="<?php echo $msg['msgId'];?>" /></td>
									<td <?php echo $style;?>><a href='#usercp_msgr/id=<?php echo $msg['msgId'];?>'><?php echo $msg['msgTitle'];?></a></td>
									<td><?php echo substr(str_replace(array("\t","\n","\r"),array(""),strip_tags($msg['msgContent'])),0,100);?> ...</td>
									<td><?php echo date("H:i:s d/m/Y",$msg['msgTime']);?></td>
									<td><?php if($msg['msgSender']==0) echo "H&#7879; th&#7889;ng";
									else{ ?><a href='#user_view/uId=<?php echo $msg['msgSender'];?>'><?php echo $_SESSION['user_data'][$msg['msgSender']]['fullname'];?></a><?php } ?></td>
								</tr>
							<?php } ?>
						</tbody>
						<?php if(isset($this->tfoot)){echo $this->tfoot;}?>
					</table>
				</div>
			</div>
		</div>
	</div>
<?php if(isset($this->breadcrumb) && isset($this->title_header)):?>
	<script type="text/javascript">
		$(function() {
			$("#title-header").text('<?php echo $this->title_header;?>');
			$("#breadcrumb").html('<?php echo build_breadcrumb($this->breadcrumb);?>');
		});
	</script>
<?php endif;?>
<?php
	if($_REQUEST['ajax']!=true) include 'footer.tpl.php';
?>